package AcWing.每日一题2025;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @author ZhuYi
 * @create 2025/3/18 22:50
 */
public class 拐杖糖盛宴_5437 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] s1 = br.readLine().split(" ");
        int n = Integer.parseInt(s1[0]);
        int m = Integer.parseInt(s1[1]);
        long[] a = new long[n + 1];//牛
        long[] b = new long[m + 1];//糖
        String[] s2 = br.readLine().split(" ");
        for (int i = 1; i <= n; i++) {
            a[i] = Long.parseLong(s2[i - 1]);
        }
        String[] s3 = br.readLine().split(" ");
        for (int i = 1; i <= m; i++) {
            b[i] = Long.parseLong(s3[i - 1]);
        }

        for (int i = 1; i <= m; i++) {
            int t = 0;
            for (int j = 1; j <= n; j++) {
                if (a[j] <= t) continue;
                int eat = (int) (Math.min(b[i], a[j]) - t);
                a[j] += eat;
                t += eat;
                if (t == b[i]) break;//优化
            }
        }

        for (int i = 1; i <= n; i++) {
            System.out.println(a[i]);
        }
    }
}
